pub fn odd_fibnacci_sum(threshold: u32) -> u32 {
    if threshold < 1 {
        return 0;
    }
    let mut pre1 = 0;
    let mut pre2 = 1;
    let mut odd_sum = 1;

    loop {
        let cur = pre1 + pre2;
        if cur > threshold {
            break;
        }
        if cur & 1 == 1 {
            odd_sum += cur;
        }
        pre1 = pre2;
        pre2 = cur;
    }
    odd_sum
}
